import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import styles from './intention.css';

import avatar from '../../../../../../../framework/utils/avatar';
import CustomsItemNoArrow from '../CustomsItemNoArrow/CustomsItemNoArrow';
import TimeInterval from './timeComponent/timeInterval';
import Line from '../../../../../../../common/borderLine/Line';

const avatarImg = require('../../../../../../../icons/personal/default-avatar.jpg');
const phoneImg = require('../../../../../../../icons/personal/basic-phone.png');
const emailImg = require('../../../../../../../icons/personal/basic-email.png');

const Intention = ({
  intentionData=[],
  onOk
}) => {

  const compileProps = {
    label: '求职意向',
    text: '编辑',
    onOk
  }

  const showType =(data) => {
    if(data){
      if(data.types && data.types.length > 0){
        return (
          data.types.map((item,index) => {
            return (
              <div key={index} className={styles.Item}>
                {item.name}
              </div>
            )
          })
        )
      }else{
        return (
          <div className={styles.listIsNull}>
            暂无
          </div>
        )
      }
    }
  }

  const showAreas =(data) => {
    if(data){
      if(data.areas && data.areas.length > 0){
        return (
          data.areas.map((item,index) => {
            return (
              <div key={index} className={styles.Item}>
                {item.name}
              </div>
            )
          })
        )
      }else{
        return (
          <div className={styles.listIsNull}>
            暂无
          </div>
        )
      }
    }
  }

  return (
    <div className={styles.container}>
      <CustomsItemNoArrow {...compileProps} />
      <Line/>
      <div className={styles.content}>
        <div className={styles.rowView}>
          <div className={styles.link}>
            兼职类型
          </div>
          <div className={styles.Arr}>
            {showType(intentionData)}
          </div>
        </div>

        <div className={styles.rowView}>
          <div className={styles.link}>
            工作区域
          </div>
          <div className={styles.Arr}>
            {showAreas(intentionData)}
          </div>
        </div>

        <div style={{paddingBottom:'0.6em'}}>
          {/* <div className={styles.link}>
            工作时间
          </div>
          <TimeInterval/> */}
        </div>
      </div>



    </div>
  )
}



  export default Intention
